const convertMenuItemId = "shirkhanConvertMenu";

chrome.runtime.onInstalled.addListener(() => {
  chrome.contextMenus.create({
    id: convertMenuItemId,
    title: "Uyghurche Kcrvnsun",
    contexts: ["all"],
  });

  chrome.contextMenus.onClicked.addListener(function ({ menuItemId }, tab) {
    console.log("tab", tab);
    if (menuItemId === convertMenuItemId) {
      console.log("转换消息已发送");
      chrome.tabs.sendMessage(
        tab.id,
        "shirkhanConvertMenu",
        function (response) {
          console.log("后台发送消息作为相应收到了的消息:", response);
        }
      );
    }
  });
});
